package com.juyu.miliao.scheduler.util;

import com.juyu.miliao.scheduler.domin.User;

import java.util.Comparator;

public class UserIsLineComparing implements Comparator<User> {


    /**
     * @param one 当前实体
     * @param other 下个实体
     * @return 负整数、零或正整数，根据此对象是小于、等于还是大于指定对象
     */
    @Override
    public int compare(User one, User other) {
        int v1 = one.getIsLine() == 0 ? 4 : one.getIsLine();
        int v2 = other.getIsLine() == 0 ? 4 : other.getIsLine();
        if(v1 < v2 )
            return -1;
        else if(v1 > v2)
            return 1;
        return 0;
    }
}